﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using QLChoDiaOc.Process;

namespace QLChoDiaOc.Forms
{
    /// <summary>
    /// Interaction logic for FormBCDVTungThang.xaml
    /// </summary>
    public partial class FormBCDVTungThang : Page
    {
        SelectInfo _selectInfo = new SelectInfo();

        public FormBCDVTungThang()
        {
            InitializeComponent();
            AddComboBox();
        }

        void AddComboBox()
        {
            cmbNamBC.Items.Clear();
            cmbThangBC.Items.Clear();
            for (int i = 1; i <= 12; i++)
                cmbThangBC.Items.Add(i);
            for (int i = 2010; i <= DateTime.Now.Year; i++)
                cmbNamBC.Items.Add(i);
        }

        private void btnBaoCaoPhieuThu_Click(object sender, RoutedEventArgs e)
        {
            if (cmbThangBC.SelectedItem == null || cmbNamBC.SelectedItem == null)
                MessageBox.Show("Chưa chọn đầy đủ thông tin", "Thông Báo");
            else
            {
                int _thang = int.Parse(cmbThangBC.SelectedItem.ToString());
                int _nam = int.Parse(cmbNamBC.SelectedItem.ToString());
                soLuongQcBangTextBox.Text = _selectInfo.SelectBCQCBangTheoThang(_thang, _nam).Count.ToString();
                soLuongQcBaoTextBox.Text = _selectInfo.SelectBCQCBaoTheoThang(_thang, _nam).Count.ToString();
                soLuongQcToBuomTextBox.Text = _selectInfo.SelectBCQCToBuomTheoThang(_thang, _nam).Count.ToString();
            }
        }
    }
}
